<template>
	<view class="">
		<nav-bar title="地址添加"></nav-bar>
		<van-address-edit :area-list="areaList" show-set-default :area-columns-placeholder="['请选择', '请选择', '请选择']"
			@save="onSave" />

	</view>
</template>

<script>
	import {
		areaList
	} from '@vant/area-data';
	const Address = uniCloud.importObject(("address"));
	import Storage from '@/untils/storage.js'
	export default {
		setup() {
			return {
				areaList,
			};
		},
		methods: {
			onSave(e) {
				Address.add({
					user_id: Storage.userinfo._id,
					name: e.name,
					tel: e.tel,
					province: e.province,
					city: e.city,
					area: e.area,
					areaCode: e.areaCode,
					detail: e.addressDetail,
					is_default: e.is_default
				}).then(res => {
					console.log(res);
				})
				console.log(e);
			}
		}
	};
</script>

<style>
</style>
